#pragma once
#include"common.h"
#include"redisObject.hpp"
#include"unordered_map.hpp"

namespace redisStruct
{

	class HashObject : public redisObject
	{
	private:
		unordered_map<stringObject*, stringObject*> _map;
	public:
		typedef unordered_map<stringObject*, stringObject*>::iterator iterator;
		HashObject() :redisObject(TYPE_HASH, TYPE_Ecoding_HASH)
		{};
		size_t size() const
		{
			return _map.size();
		}
		iterator find(stringObject* const key)
		{
			return _map.find(key);
		}
		pair<iterator, bool> insert(pair<stringObject*, stringObject*> kv)
		{
			return _map.insert(kv);
		}
		void erase( stringObject* const key)
		{
			_map.erase(key);
		}
		void replace(const pair<stringObject*, stringObject*>& kv)
		{
			_map.replace(kv);
		}

		iterator begin()
		{
			return _map.begin();
		}
		iterator end()
		{
			return _map.end();
		}
	};
}